﻿// JScript File
/// <reference path="Container.js" />
/// <reference path="_namespace.js" />

/*****************************************************************************
Ajax library class definition. Kevin Robinson 2006.
Class: ajax.components.ProgressIndicator
/*****************************************************************************/

ajax.lang.addNamespace("ajax.components");

//-----------------------------------------------------------------------------
ajax.components.ProgressIndicator = function(doc, parentNode, layerName, w, h, src)
{    
    ajax.components.ProgressIndicator.superConstructor.call(this, doc, parentNode, layerName, w, h);
    
    this.layerStyle.position = "absolute";
    this.layerStyle.backgroundColor = "White";
    this.layerStyle.padding = "10px";
    this.image      = this.doc.createElement("img");
    this.label      = this.doc.createElement("div");
    this.image.src  = src;     
}
//-----------------------------------------------------------------------------
ajax.lang.extend("ajax.components.ProgressIndicator", "ajax.components.Container");
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Override load
ajax.components.ProgressIndicator.prototype.load = function()
{
    // Call base
    ajax.components.ProgressIndicator.superClass.load.call(this);
    
    // Add image to layer
    this.layer.appendChild(this.image);    
    this.layer.appendChild(this.label);
}

//-----------------------------------------------------------------------------
ajax.components.ProgressIndicator.prototype.getText = function()
{
    return this.label.innerHTML;
}
//-----------------------------------------------------------------------------
ajax.components.ProgressIndicator.prototype.setText = function(val)
{
    this.label.innerHTML = val;
}

//-----------------------------------------------------------------------------
// Override setSize
ajax.components.ProgressIndicator.prototype.setSize = function(w, h)
{
    // Set image to size
    this.image.style.width  = w + this.units.size.width;
    this.image.style.height = h + this.units.size.height;     
    
    // Call base
    ajax.components.ProgressIndicator.superClass.setSize.call(this, w, h);
    
}

ajax.components.ProgressIndicator.prototype.toString = function()
{
    return "ajax.components.ProgressIndicator";
}


//-----------------------------------------------------------------------------
ajax.components.ProgressIndicator.cast = function(obj)
{///<returns type="ajax.components.ProgressIndicator"/>    
    return obj;
}